package ua.epam.muzalevskiy.traction.dao;

import java.util.List;
import ua.epam.muzalevskiy.traction.dao.exceptions.DatabaseException;
import ua.epam.muzalevskiy.traction.dao.exceptions.NotExistsParameterException;
import ua.epam.muzalevskiy.traction.dao.exceptions.NotUniqueParameterException;
import ua.epam.muzalevskiy.traction.vehicle.Vehicle;

/**
 * This interface defines methods that needed to select, insert, update, delete
 * data from DataBase.
 *
 * @author Muzalevskiy Vitaliy
 */
public interface VehicleDao {

    /**
     * Add new <code> Vehicle </code> value to DataBase.
     *
     * @param vehicle - concrete <code> Vehicle </code> value.     
     * @throws NotUniqueRouteNumberException if <code> Vehicle </code> with
     *      such parameters already exists in DataBase.
     */
    void addVehicle(Vehicle vehicle) throws NotUniqueParameterException;

    /**
     * Selects all vehicles in DataBase. 
     * 
     * @return <code> List </code> of <code> Vehicle </code>. 
     */
    List<Vehicle> selectAll();

    /**
     * Selects all vehicles in DataBase, that are free. 
     * 
     * @return <code> List </code> of <code> Vehicle </code>. 
     */
    List<Vehicle> selectAllReserved();
    
    /**
     * Method to get vehicle from DataBase with concrete ID.
     * 
     * @param vehicleID ID value of current vehicle.
     * @return <code> Vehicle </code> value. 
     */
    Vehicle selectVehicleByID(int vehicleID);

    /**
     * Selects all buses in DataBase. 
     * 
     * @return <code> List </code> of <code> Vehicle </code>.
     */
    List<Vehicle> selectAllBuses();

    /**
     * Selects all trolleybuses in DataBase. 
     * 
     * @return <code> List </code> of <code> Vehicle </code>.
     */
    List<Vehicle> selectAllTrolleybuses();

    /**
     * Selects all trams in DataBase. 
     * 
     * @return <code> List </code> of <code> Vehicle </code>.
     */
    List<Vehicle> selectAllTrams();

    /**
     * Delete vehicle with concrete ID.                                                                                                                                                                                                                                                                                                  
     *
     * @param vehicleID - ID of concrete vehicle
     * @throws NotExistsParameterException if there is no vehicle with
     *      such ID in DataBase.
     */
    void deleteVehicleByID(int vehicleID) 
            throws NotExistsParameterException;

    /**
     * Method for assigning to the selected route.
     *
     * @param vehicleID - identifier of vehicle.
     * @param routeID - identifier of route.
     * @throws NotExistsParameterException if there is no vehicle or route with
     *      such ID in DataBase.
     */
    void assigneToRoute(int vehicleID, int routeID) 
            throws DatabaseException, NotExistsParameterException;
}
